package com.mac.demo.controller;

import com.mac.demo.entity.AppUser;
import com.mac.demo.service.AppUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
//@Controller
@RequestMapping(value = "/a")
public class AppUserController
{
    @Autowired
    private AppUserService appUserService;


    @GetMapping("/findAll")
    public Object findAll(HttpServletRequest request)
    {
        List<AppUser> list = appUserService.findAll();

        return list;
    }

    @GetMapping("/findByToken")
    public Object findByToken(HttpServletRequest request, String token)
    {
        return appUserService.findByToken(token);
    }
}